Crate tk_sendfile [] [src]

A thread pool that can process file requests and send data to the socket with zero copy (using sendfile).

Use DiskPool structure to request file operations.

Example

let pool = DiskPool::new(CpuPool::new(40));
    pool.send("file", socket)

Settings

It's recommended to make large number of threads in the pool for three reasons:

  1. To make use of device parallelism
  2. To allow kernel to merge some disk operations
  3. To fix head of line blocking when some request reach disk but others could be served immediately from cache (we don't know which ones are cached, so we run all of them in a pool)

Structs

DiskPool

A reference to a thread pool for disk operations

PathOpener

File opener implementation that opens specified file path directly

Sendfile

A structure that tracks progress of sending a file

WriteFile

Future returned by Sendfile::write_into()

Traits

Destination

A trait that represents anything that file can be sent to

FileOpener

This trait represents anything that can open the file

FileReader

This trait represents file that can atomically be read at specific point

IntoFileOpener

Trait that represents something that can be converted into a file FileOpener